//
//  PhotoCollectionView.m
//  WXMovie
//
//  Created by mac106 on 16/4/6.
//  Copyright © 2016年 无限互联. All rights reserved.
//

#import "PhotoCollectionView.h"
#import "PhotoCell.h"

@implementation PhotoCollectionView

- (instancetype)init {
    return [self initWithFrame:CGRectZero collectionViewLayout:[[UICollectionViewFlowLayout alloc] init] ];
}
    

- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout {
    if (self = [super initWithFrame:frame collectionViewLayout:layout]) {
        self.dataSource = self;
        self.delegate = self;
        self.pagingEnabled = YES;
        
        [self registerClass:[PhotoCell class] forCellWithReuseIdentifier:@"PhotoCellID"];
        
        //[self _createUI];
    }
    return self;    
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return _dataArray.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    PhotoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"PhotoCellID" forIndexPath:indexPath];
   // NSLog(@"%@",indexPath);
    cell.imgUrlStr = _dataArray[indexPath.row];
    return cell;
}

//- (void)_createUI {
//    
//    
//    
//}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
